import http from '@/service'

export type IAccount = {
	account: string
	password: string
}

// 注册新用户
export function registerAccount(data: IAccount) {
	return http.post({
		url: '/user/register',
		data
	})
}

// 登录
export function loginRequest(data: IAccount) {
	return http.post({
		url: '/user/login',
		data,
		showLoading: true
	})
}

// 测试token
export function testToken() {
	return http.post({
		url: '/user/test/token',
		method: 'get'
	})
}

// 获取用户信息
export function getUserInfoById(params: { id: string }) {
	return http.get({
		url: '/user/userinfo',
		params,
		showLoading: true
	})
}

// 获取路由列表
export function getUserRouterList(params: { id: string }) {
	return http.get<never>({
		url: '/user/routers',
		params,
		showLoading: true
	})
}
